//
//  SourceTreeViewController.m
//  Charles＋SourceTree测试Demo1
//
//  Created by zhang on 16/7/7.
//  Copyright © 2016年 zhangdefu. All rights reserved.
//

#import "SourceTreeViewController.h"

@interface SourceTreeViewController ()

@property (weak, nonatomic) IBOutlet UITextField *firstTextField;
@property (weak, nonatomic) IBOutlet UILabel *resultLabel;
@property (weak, nonatomic) IBOutlet UITextField *secondTextField;

@end

@implementation SourceTreeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)jisuanBtn:(id)sender {
    
    NSString *first = self.firstTextField.text;
    int a = [first intValue];
    
    NSString *second = self.secondTextField.text;
    int b = [second intValue];
    
//    // int c = a+b;
//    int c = a * b;// 加修改为乘
    int c;
    
    if (a > b) {

        c = a + b;
    }else{
        c = a - b;

    }
    
    NSString *result = [NSString stringWithFormat:@"%d", c];
    self.resultLabel.text = result;
    
    [self.secondTextField resignFirstResponder];
}


@end
